import 'package:aichat_flutter_wallet/module_common/utils/colors.dart';
import 'package:aichat_flutter_wallet/module_common/widgets/image/public_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class NewsHeaderWidget extends StatelessWidget {
  String? title;
  VoidCallback? backCall;
  Widget? right;
  Color? colors;
  NewsHeaderWidget(
      {Key? key,
      this.title = '',
      this.backCall,
      this.right,
      this.colors = Colors.white})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    final statusBarHeight = MediaQuery.of(context).padding.top;
    return Column(
      children: [
        SizedBox(
          height: statusBarHeight,
        ),
        Container(
          color: colors,
          height: 44,
          width: double.infinity,
          child: Stack(
            children: [
              Container(
                child: Text(
                  '${title}',
                  textAlign: TextAlign.center,
                  style: TextStyle(fontSize: 16, color: AppColors.c_333333),
                ),
                alignment: Alignment.center,
              ),
              Positioned(
                child: InkWell(
                  splashColor: Colors.transparent,
                  onTap: (){
                    if(backCall!=null){
                      backCall!();
                    }
                  },
                  child: Container(
                    color: colors,
                    height: 44,
                    width: 44,
                    alignment: Alignment.center,
                    child: PublicImage(
                      height: 20.h,
                      width: 20.w,
                      image: 'assets/images/common/back.png',
                    ),
                  ),
                ),
                left: 10,
              ),
              Positioned(
                child: Container(
                  color: colors,
                  height: 44,
                  width: 44,
                  alignment: Alignment.center,
                  child: right,
                ),
                right: 10,
              )
            ],
          ),
        ),
      ],
    );
  }
}
